<?php
$panelSettings = Zend_Json::decode($this->panel->settings);
$align = $panelSettings['align'];

$seats = 1;
if (isset($this->unit->seats)){
    $seats = (int)$this->unit->seats;
}

$luggage = 1;
if (isset($this->unit->luggage)){
    $luggage = (int)$this->unit->luggage;
}

$doors = 1;
if (isset($this->unit->doors)){
    $doors = $this->unit->doors;
}

$engine = 0;
if (isset($this->unit->engine)){
    $engine = $this->unit->engine;
}

$transmission = "?";
if (isset($this->unit->transmission)){
    $transmission = $this->unit->transmission;
}

?>
<div id="<?php echo $this->panel->getDivID() ?>">
    <div class="RM_unit_details_vehicle_container" style="text-align:<?php echo $panelSettings['align'];?>">
        <div class="RM_unit_details_vehicle">
            <table cellpadding="5" cellspacing="5" border="0">
                <tbody><tr>
                    <tr>
                        <td width="25%"><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Fields', 'Seats'); ?></td>
                        <td>&nbsp;</td>
                        <td>
                            <?php
                            for ($i = 1; $i <= $seats; $i++){
                                echo '<img src="'.RM_Environment::getConnector()->getRootURL().'RM/userdata/plugins/Vehicle/images/man.gif" alt="" border="0"/>';
                            }
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Fields', 'Luggage'); ?></td>
                        <td>&nbsp;</td>
                        <td>
                            <?php
                            for ($i = 1; $i <= $luggage; $i++){
                                echo '<img src="'.RM_Environment::getConnector()->getRootURL().'RM/userdata/plugins/Vehicle/images/suitcase.gif" alt="This vehicle is suitable for '.$luggage.' suit cases" border="0"/>';
                            }
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Fields', 'Doors'); ?></td>
                        <td>&nbsp;</td>
                        <td><?php echo $doors; ?> Door</td>
                    </tr>
                    <tr>
                        <td><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Fields', 'Engine'); ?></td>
                        <td>&nbsp;</td>
                        <td><?php echo $engine; ?></td>
                    </tr>
                    <tr>
                        <td><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Fields', 'Transmission'); ?></td>
                        <td>&nbsp;</td>
                        <td><?php echo RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('RM.Vehicle.Transmissions', $transmission); ?></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>